﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading;
/// <summary>
/// WaittingLend 的摘要说明
/// </summary>
public class WaittingLend
{
	public WaittingLend()
	{
       
	}
    //用来检测是否书籍已经被借阅
    public bool reflashResult(string bookid,int justnow)
    {
        bool flag = false;
        ThreadStart threadStart = new ThreadStart(delegate()
        {
            SQL sql = new SQL();
            while (true)
            {
                if (Convert.ToInt32(sql.EXQSQL("select COUNT(*) from Borrow_books_manage where BookID='" + bookid + "'")) > justnow)
                {
                    flag = true;
                    break;


                }
                else
                    Thread.Sleep(1000);
            }

        });
        Thread thread = new Thread(threadStart);
        thread.Start();//多线程启动匿名方法

        while (!flag)
        {
            Thread.Sleep(1000);
        }
        thread.Abort();
        
        //等待线程结束
        return flag;

    }




}